#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    void dfs(vector<int>& x, vector<int>& y, vector<int>& z, size_t n)
    {
        if (n == 1)
        {
            z.push_back(x.back());
            x.pop_back();
            return;
        }
        dfs(x, z, y, n - 1);
        int back = x.back();
        z.push_back(back);
        x.pop_back();
        dfs(y, x, z, n - 1);
    }
    void hanota(vector<int>& A, vector<int>& B, vector<int>& C) {
        dfs(A, B, C, A.size());
    }
};